<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Menu
 *
 * @author julien
 */
require_once 'Classes/View/ViewItems/ComposedViewItem.php';
require_once 'Classes/View/ViewItems/LinkItem.php';
require_once 'Classes/View/ViewItems/ListItem.php';

class Menu extends ComposedViewItem{
   private $elements;
   public function __construct($link=null) {
       parent::__construct();
       $this->elements = new ListItem();
       if(!is_null($link)){
            $this->addLink($link);
       }
       $this->addElement($this->elements);
       
   }
   
   public function addLink($link){
       if(is_array($link)){
           foreach ($link as $value) {
               $this->addLink($value);
           }
       }
       else if(is_a($link,'LinkItem')){
            $this->elements->addElement($link);
       }
       else if(!is_null($element) && $element != ""){
            $this->elements->addElement(new LinkItem('#',$link));
       }
   }
}

?>
